from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
# 初始化driver
driver = webdriver.Chrome()
# 打开页面
driver.get("https://mail.163.com/")
# 最大化
driver.maximize_window()
# 设置隐式等待
driver.implicitly_wait(15)

#iframe框架跳进
iframe = driver.find_elements(By.TAG_NAME,"iframe")[0]
driver.switch_to.frame(iframe)

# 输入账号
driver.find_element(By.NAME,"email").send_keys("baijiacheng_123")

# 输入密码
driver.find_element(By.NAME,"password").send_keys("baijiacheng123.")

# 点击登录
driver.find_element(By.ID,"dologin").click()

# 跳出iframe，回到默认的上下文
driver.switch_to.default_content()

# 点击未读邮件 Fj0[0]
driver.find_elements(By.CLASS_NAME,"Fj0")[0].click()

sleep(5)